<include file='Base:header' />
<style>
.tag:visited{background-color: #ed6d3d;}
	table{
		font-size: 12px;
	}
	.table-bordered {
	    border-bottom: 1px solid #d9d9d9;
	    border-collapse: separate;
	    border-left: 0;
	    -webkit-border-radius: 3px;
	    -moz-border-radius: 3px;
	    border-radius: 3px;
	}
	.table-list {
	    margin-bottom: 0px;
	}
	.table_right,.table_left {
		width: 800px;
		text-align: center;
	    max-width: 100%;
	    background-color: #fff;
	    border-collapse: collapse;
	    border-spacing: 0;
		float: left;
	}
	.table_left{
		width: 80px;
	}
	.table_right>thead>tr>th,.table_left>thead>tr>th{
	    border-bottom: 1px solid #d9d9d9;
	}
	.table_right thead th,.table_left thead th {
	    vertical-align: bottom;
	}
	.table_right th, .table_right td,.table_left th, .table_left td {
		text-align: center;
	    vertical-align: middle;
	}
	.table-bordered th, .table-bordered td {
	    border-left: 1px solid #d9d9d9;
	}
	.table_right th, .table_right td,.table_left th, .table_left td  {
	    padding: 6px;
	    line-height: 20px;
	    text-align: left;
	    vertical-align: top;
	    border-top: 1px solid #d9d9d9;
	}
	.table_right th,.table_left th{
		line-height: 23px;
		height: 60px;
		text-align: center;
		width: 70px;
		color: black;
		font-weight: normal;
		box-sizing: border-box;
	}
	.table_right th:nth-of-type(1),.table_right td:nth-of-type(1){
		border-left: none;
	}
	.rb tr:nth-of-type(1) td,.lb tr:nth-of-type(1) td{
		border-top: none;
	}
	.table_left th,.table_left td{
		border-right:  1px solid #d9d9d9;
	}
	.table_right td,.table_left td{
		text-align: center;
		overflow: scroll;
		width: 70px;
		height: 61px;
		color: #999;
		box-sizing: border-box;
	}
	.lt_top{
		position: fixed;
		left: 0;
		top: 115px;
		z-index: 100;
	}
	.lb_top{
		margin-top: 60px;
	}
	.rt_top{
		position: absolute;
		left: 80px;
		top: 0;
		z-index: 50;
		width: 800px;
	}
	.rb_top{
		margin-top: 60px;
	}
	.lt_left{
		position: fixed;
		left: 0;
		top: 115px;
		z-index: 100;
	}
	.lb_left{
		margin-top: 60px;
	}
	.rt_left{
		position: absolute;
		top:0;
		z-index: 50;
		width: 800px;
	}
	.rb_left{
		margin-top: 60px;
	}
	.tab2_div th{width: 105px;}
</style>
	<body>
		<div class="out_list">
			<h1 class="title">
				<a class="back" href="{$goback}">
					<img class="fl" src="__IMG__/back.png" style="margin-left: 5%;"/>
				</a>
				高管行程
				<a class="home" href="__APP__">
					<img class="fl" src="__IMG__/home_logo.png" style="margin-right: 5%;"/>
				</a>
			</h1>
			
			<neq name='_GET[type]' value='5'>
				<div class="weui-cells">
					<a class="weui-cell weui-cell_access" href="{:U('submit',['type'=>$_GET['type'],'out_time'=>date('Y-m-d 18:00'),'overtime_start'=>date('Y-m-d 20:00'),'overtime_end'=>date('Y-m-d 05:59',strtotime('+1 day'))])}">
					    <div class="weui-cell__bd">
					      	<p>编辑行程</p>
					    </div>
					    <div class="weui-cell__ft">
					    </div>
					</a>
				</div>
			</neq>	
			<br />
			<div class="weui-tab">
				<div class="weui-navbar">
					<a isclick="no" class="weui-navbar__item" number="1" href="#tab1">
						上周
					</a>
					<a isclick="yes" class="weui-navbar__item weui-bar__item--on" number="2" href="#tab2">
						本周
					</a>
					<a isclick="no" class="weui-navbar__item" href="#tab3" number="3">
						下周
					</a>
				</div>
				<div class="weui-tab__bd">
					<div id="tab1" class="weui-tab__bd-item" style="position: relative;">
						<div style="overflow:scroll;width:80px;float: left;">
							<table class='lt table_left table-hover table-bordered table-list'>
								<thead>
									<tr>
										<th width="" style="line-height: 45px;">姓名</th>
									</tr>
								</thead>
							</table>
							<table class='lb table_left table-hover table-bordered table-list p_name' id="p_name">
								<php>$data = [data]</php>
								 	<volist name="data" id='vo'>	
								 		
									</volist>
							</table>
						</div>
						
						<div class="tab2_div" style="overflow:scroll;">
							<div style="width: 800px;position: relative;">
								<table class='rt table_right table-hover table-bordered table-list' >
									<thead>
										<tr>
											<!--<th class="data-active" style="line-height: 45px;">{$date.0}(周一)</th>
											<th class="data-active" style="line-height: 45px;">{$date.1}(周二)</th>
											<th class="data-active" style="line-height: 45px;">{$date.2}(周三)</th>
											<th class="data-active" style="line-height: 45px;">{$date.3}(周四)</th>
											<th class="data-active" style="line-height: 45px;">{$date.4}(周五)</th>
											<th class="data-active" style="line-height: 45px;">{$date.5}(周六)</th>
											<th class="data-active" style="line-height: 45px;">{$date.6}(周日)</th>-->
										</tr>
									</thead>
								</table>
							</div>
							<div style="width: 800px;position: relative;">
								<table  class='rb table_right table-hover table-bordered table-list p_type' id="p_type">
								</table>
							</div>
						</div>	
					</div>
					
					<div id="tab2" class="weui-tab__bd-item weui-tab__bd-item--active" style="position: relative;">
						<div style="overflow:scroll;width:80px;float: left;">
							<table class='lt table_left table-hover table-bordered table-list'>
								<thead>
									<tr>
										<th width="" style="line-height: 45px;">姓名</th>
									</tr>
								</thead>
							</table>
							<table class='lb table_left table-hover table-bordered table-list p_name' id="p_name">
								<php>$data = [data]</php>
								 	<volist name="data" id='vo'>	
								 		
									</volist>
							</table>
						</div>
						
						<div class="tab2_div" style="overflow:scroll;">
							<div style="width: 800px;position: relative;">
								<table class='rt table_right table-hover table-bordered table-list' >
									<thead>
										<tr>
											<!--<th class="data-active" style="line-height: 45px;">(周一)</th>
											<th class="data-active" style="line-height: 45px;">(周二)</th>
											<th class="data-active" style="line-height: 45px;">(周三)</th>
											<th class="data-active" style="line-height: 45px;">(周四)</th>
											<th class="data-active" style="line-height: 45px;">(周五)</th>
											<th class="data-active" style="line-height: 45px;">(周六)</th>
											<th class="data-active" style="line-height: 45px;">(周日)</th>-->
										</tr>
									</thead>
								</table>
							</div>
							<div style="width: 800px;position: relative;">
								<table  class='rb table_right table-hover table-bordered table-list p_type' id="p_type">
								</table>
							</div>
						</div>	
					</div>
					
					<div id="tab3" class="weui-tab__bd-item" style="position: relative;">
						<div style="overflow:scroll;width:80px;float: left;">
							<table class='lt table_left table-hover table-bordered table-list'>
								<thead>
									<tr>
										<th width="" style="line-height: 45px;">姓名</th>
									</tr>
								</thead>
							</table>
							<table class='lb table_left table-hover table-bordered table-list p_name' id="p_name">
<!-- 								<php>$data = [data]</php>
								 	<volist name="data" id='vo'>	
								 		
									</volist> -->
							</table>
						</div>
						
						<div class="tab2_div" style="overflow:scroll;">
							<div style="width: 800px;position: relative;">
								<table class='rt table_right table-hover table-bordered table-list' >
									<thead>
										<tr>
											<!--<th class="data-active" style="line-height: 45px;">(周一)</th>
											<th class="data-active" style="line-height: 45px;">(周二)</th>
											<th class="data-active" style="line-height: 45px;">(周三)</th>
											<th class="data-active" style="line-height: 45px;">(周四)</th>
											<th class="data-active" style="line-height: 45px;">(周五)</th>
											<th class="data-active" style="line-height: 45px;">(周六)</th>
											<th class="data-active" style="line-height: 45px;">(周日)</th>-->
										</tr>
									</thead>
								</table>
							</div>
							<div style="width: 800px;position: relative;">
								<table  class='rb table_right table-hover table-bordered table-list p_type' id="p_type">
								</table>
							</div>
						</div>	
					</div>
				</div>
			</div>		
			
			<div class="weui-cells" id='list-box'>
				
			</div>
		</div>
 		<div class="weui-loadmore" id='loading' style="display:none">
		  <i class="weui-loading"></i>
		  <span class="weui-loadmore__tips">正在加载</span>
		</div> 
		<include file='Base:footer' />
		<script type="text/javascript">
			var _range = $(".weui-bar__item--on").attr("number");
			console.log(_range)
			$(".weui-navbar__item").click(function(){
				var __this = $(this); 
				var isclick = __this.attr("isclick");
				console.log(isclick)
				var _range = __this.attr("number")
				if(isclick == "no"){
					$.ajax({
						type:"post",
						data:{'range':_range},
						url:"./index.php?g=&m=Schedule&a=showlist",
						success:function(ret){
							var name_html = "";
							var current_sn = ret.current_sn;
							for(var name in ret.data){
								var type_html = "";
								var type_td = "";
								name_html += "<tr><td style='line-height: 48px;'>"+name+"</td></tr>";
								for(var type in ret.data[name]){
									var sn = ret.data[name][type].sn;
									if(current_sn = sn){
										if(ret.data[name][type].type){
											if(ret.data[name][type].text){
												type_td +="<td style='line-height: 24px;' ><a style='color:#999' href='/insight20170117_attendance/index.php?g=&m=Schedule&a=submit&data="+type+"'>"+ret.data[name][type].type+":"+ret.data[name][type].text+"</a></td>";
											}else{
												type_td +="<td style='line-height: 48px;' ><a style='color:#999' href='/insight20170117_attendance/index.php?g=&m=Schedule&a=submit&data="+type+"'>"+ret.data[name][type].type+"</a></td>";	
											}
										}else{
											type_td +="<td style='line-height: 48px;'><a style='color:#999' href='/insight20170117_attendance/index.php?g=&m=Schedule&a=submit&data="+type+"'></a></td>";
										}
									}else{
										if(ret.data[name][type].type){
											if(ret.data[name][type].text){
												type_td +="<td style='line-height: 24px;' >"+ret.data[name][type].type+":"+ret.data[name][type].text+"</td>";
											}else{
												type_td +="<td style='line-height: 48px;' >"+ret.data[name][type].type+"</td>";	
											}
										}else{
											type_td +="<td style='line-height: 48px;'></td>";
										}
									}
									
								}
								type_html = "<tr>"+type_td+"</tr>";
								$(".weui-tab__bd-item--active .p_type").append(type_html)
							}
							$(".weui-tab__bd-item--active .p_name").append(name_html)
							
					
							for(var i in ret.week){
								var _week = "";
								switch(i)
								{
								    case "0":
								    	_week = "周一";
								           break;
								    case "1":
								    	_week = "周二";
								           break;
								    case "2":
								    	_week = "周三";
								           break;
								    case "3":
								    	_week = "周四";
								           break;
								    case "4":
								    	_week = "周五";
								           break;
								    case "5":
								    	_week = "周六";
								           break;
								    default:
              							_week = "周日";
								}
								var data_html = "<th class='data-active'>"+ret.week[i]+"<br />"+_week+"</th>";
								$(".weui-tab__bd-item--active .rt tr").append(data_html)
							}
							__this.attr("isclick","yes")
						}
					});
				}
				
				
			})
			$.ajax({
				type:"post",
				async:false,
				data:{'range':_range},
				url:"./index.php?g=&m=Schedule&a=showlist",
				success:function(ret){
					var name_html = "";
					var current_sn = ret.current_sn;
					var _data = "";
					for(var name in ret.data){
						var type_html = "";
						var type_td = "";
						name_html += "<tr><td style='line-height: 48px;'>"+name+"</td></tr>";
						for(var type in ret.data[name]){
//							_data = type.substring(5,10);
							_data = type.replace(/\b(0+)/gi,"");
							var sn = ret.data[name][type].sn;
							if(current_sn = sn){
								if(ret.data[name][type].type){
									if(ret.data[name][type].text){
										type_td +="<td style='line-height: 24px;' ><a style='color:#999' href='/insight20170117_attendance/index.php?g=&m=Schedule&a=submit&data="+type+"'>"+ret.data[name][type].type+":"+ret.data[name][type].text+"</a></td>";
									}else{
										type_td +="<td style='line-height: 48px;' ><a style='color:#999' href='/insight20170117_attendance/index.php?g=&m=Schedule&a=submit&data="+type+"'>"+ret.data[name][type].type+"</a></td>";	
									}
								}else{
									type_td +="<td style='line-height: 48px;'><a style='color:#999' href='/insight20170117_attendance/index.php?g=&m=Schedule&a=submit&data="+type+"'></a></td>";
								}
							}else{
								if(ret.data[name][type].type){
									if(ret.data[name][type].text){
										type_td +="<td style='line-height: 24px;' >"+ret.data[name][type].type+":"+ret.data[name][type].text+"</td>";
									}else{
										type_td +="<td style='line-height: 48px;' >"+ret.data[name][type].type+"</td>";	
									}
								}else{
									type_td +="<td style='line-height: 48px;'></td>";
								}
							}
						}
						type_html = "<tr>"+type_td+"</tr>";
						$(".weui-tab__bd-item--active .p_type").append(type_html)
					}
					$(".weui-tab__bd-item--active .p_name").append(name_html)
					for(var i in ret.week){
						var _week = "";
						switch(i)
						{
						    case "0":
						    	_week = "周一";
						           break;
						    case "1":
						    	_week = "周二";
						           break;
						    case "2":
						    	_week = "周三";
						           break;
						    case "3":
						    	_week = "周四";
						           break;
						    case "4":
						    	_week = "周五";
						           break;
						    case "5":
						    	_week = "周六";
						           break;
						    default:
      							_week = "周日";
						}
						var data_html = "<th class='data-active'><span >"+ret.week[i]+"<br />"+_week+"</span></th>";
						$(".weui-tab__bd-item--active .rt tr").append(data_html)
					}
					
/* 					$('.table_right th').css({'display': 'inline-block',
				    'border-bottom': '1px solid #ffffff','width':'160px'}) */
				}
			});
		</script>
	</body>
</html>